<template>
	<div>
		<template v-for="(item, index) in getOptions" :key="index">
			<span>{{ index != 0 ? '、' : '' }}{{ item[config.label] }}</span>
		</template>
	</div>
</template>
<script>
export default {
	props: {
		options: [],
		value: [String, Number]
	},
	data() {
		return {
			config: {
				label: 'name',
				value: 'value'
			},
		}
	},
	computed: {
		values(){
			console.log(this.value,'this.value')
			if (this.value !== null && typeof this.value !== 'undefined') {
				return Array.isArray(this.value) ? this.value : String(this.value).split(',');
			}
			else {
				return [];
			}
		},
		getOptions(){
			return this.options.filter(item => this.values.includes(item[this.config.value]) );
		}
	},
	mounted() {
		console.log(this.options,'options')
	},
}
</script>
